import { teacherSchema } from './schemas';
import CONFIG from '../config/config';

const mongoose = require('mongoose');
const Promise = require('bluebird');

mongoose.Promise = Promise;

mongoose.connect(`mongodb://${CONFIG.db.host}:${CONFIG.db.port}/${CONFIG.db.dbname}`, {
  config: {
    autoIndex: false,
  },
});

const TeacherModel = mongoose.model(CONFIG.db.collection, teacherSchema);

export default TeacherModel;
